package com.jadefashion.quartz;


import com.jadefashion.service.OrderSettingService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Calendar;

@Component("cleanOrderSettingObject")
public class CleanOrderSettingObject {
    @Reference
    private OrderSettingService orderSettingService;

    public  void clean() {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.DAY_OF_MONTH, 0);
        String lastDay = simpleDateFormat.format(calendar.getTime());
        //System.out.println(lastDay);
        orderSettingService.cleanOrderSetting(lastDay);
        System.out.println("清理成功");
    }
}
